﻿ <?php
/**********************************************************
** Lime Manager
** Thomas Knobloch & Clement Troesch
** Manager Ajax Users View
***********************************************************/
?>
<?php include_once "../../model/DevelopperModel.php"; ?>
<?php include_once "../../model/SessionModel.php"; ?>
<?php include_once "../../model/DevelopperModel.php"; ?>
<?php include_once "../main/QueryTableView.php"; ?>
<?php session_start(); ?>

<div class="section_title" id="objects"><h1> Objets </h1></div>
<div class="section_info">
	Obtention des renseignements sur les objets, nombre d'objets par type, liste des objets par types.
</div>

<div class="article">

<div class="section_title_small_blue"><h4>Sélectionnez un type d'objet</h4></div>

<table class="tableQueryCenter">
	<tr>
		<th>Type d'objet</th>
		<th>Nombre</th>
		<th>Afficher</th>
	</tr>
<?php
	$nbRow = DevelopperModel::getObjectTypes($_SESSION['session']->currentConnection, $result);
	
	if(isset($_GET['selected_type']))
		$selectedType = $_GET['selected_type'];
	
	foreach ($result as $row) {
		echo "<tr>";
		echo "<td>".$row['OBJECT_TYPE']."</td>\n";
		echo "<td>".$row['COUNT(OBJECT_TYPE)']."</td>\n";
		
		if(isset($selectedType) && $selectedType == $row['OBJECT_TYPE'])
		{
			?><td><img src="img/check.png" alt="check" /></td><?php
		}
		else
		{
			?><td><a href="#objects"><img src="img/find.png" alt="zoom" onClick="displayObjects('<?php echo $row['OBJECT_TYPE'] ?>')" /></a></td><?php
		}
		
		
		echo"</tr>";
	}
?>
</table>

<br />

<?php
if(isset($selectedType))
{
	$nbRow2 = DevelopperModel::getObjects($_SESSION['session']->currentConnection, $result2, $selectedType, $columns);
	?>
	
	<div class="section_title_small_green"><h4><?php echo $selectedType ?></h4></div>
	
	<div class="section_title_small_blue"><h4>Informations</h4></div>
	
	<?php
	
	displayResult($result2, $columns);

	?>
	
	
	<br />

<?php
}
?>

</div>



